
$(function() {

	System.Gadget.onSettingsClosing = settingsClosing;	
	
	$("#username").val(System.Gadget.Settings.readString("username"));
	$("#password").val(System.Gadget.Settings.readString("password"));
	$("#numberToRing").val(System.Gadget.Settings.readString("numberToRing"));
});


function settingsClosing(event) {
	
	if (event.closeAction == event.Action.commit) {
		System.Gadget.Settings.write("username", $("#username").val());
		System.Gadget.Settings.write("password", $("#password").val());
		System.Gadget.Settings.write("numberToRing", $("#numberToRing").val());
	}
	
	event.cancel = false;	
}
